﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Data.UserDb;

namespace Acc_Web.controls
{
    public partial class Category : System.Web.UI.UserControl
    {
        public Int32 SrvId
        {
            get
            {
                return ViewState[ID + "_serverid"] == null ? 0 : Convert.ToInt32(ViewState[ID + "_serverid"]);
            }
            set
            {
                ViewState[ID + "_serverid"] = value;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                var sr = new ShopRepository();
                categoryList.DataSource = sr.GetCategoryBySrvId(SrvId);
                categoryList.DataBind();
            }
        }
    }
}